<template>
    <div id="main">
	  <daohang :list=list></daohang>
	<h3>欢迎 {{name}}</h3>
        <h3>所有注册用户</h3>
        <ul>
            <li v-for="item in list">
                {{item.username}}
            </li>
        </ul>
    </div>
</template>

<style>
    ul{padding: 0;}
    ul li{list-style: none;}
</style>

<script>
import vueleftData from '../../daohang/chart-options/vueleftData';
import daohang from '../../daohang/shuxing.vue';
import { setCookie,getCookie,delCookie } from '../assets/js/cookie.js'
    export default{
	    name:'main',
        data(){
		let list=vueleftData.data.list;
            return{
                list: list,
				name:''
            }
        },
        mounted(){
            /*this.$http.get('http://localhost/vueapi/index.php/Home/user/index').then((res)=>{
                this.list = res.data
                console.log(res)
            })*/
			     /*页面挂载获取保存的cookie值，渲染到页面上*/
            let uname = getCookie('username');
	        this.name = uname;
			
			this.list=[
			{username:'yanling1'},
			{username:'yanling2'},
			{username:'yanling3'}
			]
        },
  components: {
    daohang
  }
    }
</script>